1. Technical Field
The present invention relates in general to techniques for correcting or "debugging" computer software code and, in particular, to a source-level run-time software code debugging instrument using a built-in software debugger that is transparent to and co-resident with a target system code.
2. Description of the Related Art
A program monitor is intrusive software code located in target memory to debug computer programs. The program monitor operates in conjunction with and monitors the operation of a main computer program that controls the functions of a microcontroller-based target circuit. The program monitor code is intrusive in that it is linked to the main program code, both of which are either downloaded into memory sites provided in the target circuit or stored in a read only memory (ROM) used by the programmer. The use of a monitor program requires that a universal asynchronous receiver-transmitter or other communication hardware be provided in the target circuit so that the monitor can communicate apart from the main program to the programmer.
The use of program monitors is advantageous because they are relatively inexpensive and find the majority of errors or "bugs" located in the main program. One drawback of program monitors is that they require the use of resources in the target circuit and typically are ineffective in detecting more difficult problems present in the associated program code.
The in-circuit emulator has become a standard tool for debugging microcontrollers and microprocessors. A variety of emulators are available often consisting of an adapter board which plugs directly into an IBM PC/XT/AT bus with cable attachment to a pod containing a "bond-out" microcontroller. The "bond-out" microcontroller in the pod plugs directly into the target system in lieu of the target system's microcontroller. A PC debugger software application program is then invoked to display and manipulate the target system's registers, to start and stop traces, and to set and reset breakpoints at specific program addresses or at specific reads or writes to data addresses.
Besides the burden of considerable expense of the emulator adapter board and pod unit, valuable slot space within the PC is used. To get around PC slot usage, emulator manufacturers offer a stand-alone emulator called an Expansion Box, allowing the emulator to operate outside the PC. The Expansion Box has its own power supply and is either serial, parallel or modem attached to the PC. Examples of emulator manufacturers include Nohau Corporation (EMUL51-PC emulator), and Intel Corporation (ICE-51 emulator).
One type of debugger function, single stepping, is described by Intel's Microcontroller User Manual, 1982, page 6-28, section 6.8.3, "How to Single-Step the 8051". This article specifies that one of the external interrupts be level activated and held normally low. It further describes how an external interrupt routine can be made to execute following each instruction of the target system by toggling the external interrupt input pin high and low with a push button switch. The article does not however, describe a software debug tool. Instead, it describes a hardware technique of examining the 8031 port 0 and port 2 address and data lines in conjunction with single stepping the code with the push button.
As will be appreciated, one major drawback of emulation in the prior art is that emulators are relatively expensive, thereby making them inaccessible to a significant percentage of the growing number of software engineers participating in microcontroller-based circuit design tasks. Besides the considerable expense of emulator adaptor boards and pod units, valuable slot space within in the PC is used to accommodate such debugging techniques. Further, prior art techniques involve complicated hardware manipulations and analyzation to perform the debugging procedure. What is needed is a debugging method and system that performs the emulator debugging functions on an off-the-shelf microcontroller in place in the system under test without the need for in-circuit emulator technology, additional microcontroller on-board circuitry, or a supporting microcontroller designed into the system under test.